<?php
function smarty_modifier_keyword_replace($string, $replace)
{
	preg_match_all('/%[\w-]+%/', $string, $pattern);
	$new_pattern = array_map("add_slashes", $pattern[0]);
	
	return preg_replace($new_pattern, $replace, $string);
}

function add_slashes($val) {
	return '/'.$val.'/';
}
?>
